package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CheckIfAnIntArrayContainsAnIntValue {
	public static void main(String[] argv) {
		int[] array = new int[]{34, 35, 36, 37, 37, 37, 67, 68, 69};
		int key = 2;
		System.out.println("int 数组是否包含 2？" + contains(array, key));
	}

	public static boolean contains(int[] array, int key) {
		for (int i = 0; i < array.length; i++) {
			if (array[i] == key) {
				return true;
			}
		}
		return false;
	}
}
